3.9.76 \(\int (d \cos (e+f x))^n (a+b \sec (e+f x))^2 \, dx\) [876]

Optimal. Leaf size=186 \[ -\frac {2 a b (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {2+n}{2};\cos ^2(e+f x)\right ) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}-\frac {\left (a^2 (1-n)-b^2 n\right ) \cos (e+f x) (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {1+n}{2};\frac {3+n}{2};\cos ^2(e+f x)\right ) \sin (e+f x)}{f (1-n) (1+n) \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \cos (e+f x))^n \tan (e+f x)}{f (1-n)} \]

[Out]

-2*a*b*(d*cos(f*x+e))^n*hypergeom([1/2, 1/2*n],[1+1/2*n],cos(f*x+e)^2)*sin(f*x+e)/f/n/(sin(f*x+e)^2)^(1/2)-(a^
2*(1-n)-b^2*n)*cos(f*x+e)*(d*cos(f*x+e))^n*hypergeom([1/2, 1/2+1/2*n],[3/2+1/2*n],cos(f*x+e)^2)*sin(f*x+e)/f/(
-n^2+1)/(sin(f*x+e)^2)^(1/2)+b^2*(d*cos(f*x+e))^n*tan(f*x+e)/f/(1-n)

________________________________________________________________________________________

Rubi [A]
time = 0.17, antiderivative size = 186, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {4349, 3873, 3857, 2722, 4131} \begin {gather*} -\frac {\left (a^2 (1-n)-b^2 n\right ) \sin (e+f x) \cos (e+f x) (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {n+1}{2};\frac {n+3}{2};\cos ^2(e+f x)\right )}{f (1-n) (n+1) \sqrt {\sin ^2(e+f x)}}-\frac {2 a b \sin (e+f x) (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {n+2}{2};\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \cos (e+f x))^n}{f (1-n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(d*Cos[e + f*x])^n*(a + b*Sec[e + f*x])^2,x]

[Out]

(-2*a*b*(d*Cos[e + f*x])^n*Hypergeometric2F1[1/2, n/2, (2 + n)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(f*n*Sqrt[Sin[
e + f*x]^2]) - ((a^2*(1 - n) - b^2*n)*Cos[e + f*x]*(d*Cos[e + f*x])^n*Hypergeometric2F1[1/2, (1 + n)/2, (3 + n
)/2, Cos[e + f*x]^2]*Sin[e + f*x])/(f*(1 - n)*(1 + n)*Sqrt[Sin[e + f*x]^2]) + (b^2*(d*Cos[e + f*x])^n*Tan[e +
f*x])/(f*(1 - n))

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3873

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Dist[2*a*(b/d
), Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b
, d, e, f, n}, x]

Rule 4131

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(-C)*Cot
[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x
] /; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rule 4349

Int[(u_)*((c_.)*sin[(a_.) + (b_.)*(x_)])^(m_.), x_Symbol] :> Dist[(c*Csc[a + b*x])^m*(c*Sin[a + b*x])^m, Int[A
ctivateTrig[u]/(c*Csc[a + b*x])^m, x], x] /; FreeQ[{a, b, c, m}, x] &&  !IntegerQ[m] && KnownSecantIntegrandQ[
u, x]

Rubi steps

\begin {align*} \int (d \cos (e+f x))^n (a+b \sec (e+f x))^2 \, dx &=\left ((d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int (d \sec (e+f x))^{-n} (a+b \sec (e+f x))^2 \, dx\\ &=\left ((d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int (d \sec (e+f x))^{-n} \left (a^2+b^2 \sec ^2(e+f x)\right ) \, dx+\frac {\left (2 a b (d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int (d \sec (e+f x))^{1-n} \, dx}{d}\\ &=\frac {b^2 (d \cos (e+f x))^n \tan (e+f x)}{f (1-n)}+\frac {\left (2 a b \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \cos (e+f x))^n\right ) \int \left (\frac {\cos (e+f x)}{d}\right )^{-1+n} \, dx}{d}+\left (\left (a^2-\frac {b^2 n}{1-n}\right ) (d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int (d \sec (e+f x))^{-n} \, dx\\ &=-\frac {2 a b (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {2+n}{2};\cos ^2(e+f x)\right ) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \cos (e+f x))^n \tan (e+f x)}{f (1-n)}+\left (\left (a^2-\frac {b^2 n}{1-n}\right ) \left (\frac {\cos (e+f x)}{d}\right )^{-n} (d \cos (e+f x))^n\right ) \int \left (\frac {\cos (e+f x)}{d}\right )^n \, dx\\ &=-\frac {2 a b (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {2+n}{2};\cos ^2(e+f x)\right ) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}-\frac {\left (a^2-\frac {b^2 n}{1-n}\right ) \cos (e+f x) (d \cos (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {1+n}{2};\frac {3+n}{2};\cos ^2(e+f x)\right ) \sin (e+f x)}{f (1+n) \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \cos (e+f x))^n \tan (e+f x)}{f (1-n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.26, size = 161, normalized size = 0.87 \begin {gather*} -\frac {d (d \cos (e+f x))^{-1+n} \csc (e+f x) \left (b^2 n (1+n) \, _2F_1\left (\frac {1}{2},\frac {1}{2} (-1+n);\frac {1+n}{2};\cos ^2(e+f x)\right )+a (-1+n) \cos (e+f x) \left (2 b (1+n) \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {2+n}{2};\cos ^2(e+f x)\right )+a n \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1+n}{2};\frac {3+n}{2};\cos ^2(e+f x)\right )\right )\right ) \sqrt {\sin ^2(e+f x)}}{f (-1+n) n (1+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(d*Cos[e + f*x])^n*(a + b*Sec[e + f*x])^2,x]

[Out]

-((d*(d*Cos[e + f*x])^(-1 + n)*Csc[e + f*x]*(b^2*n*(1 + n)*Hypergeometric2F1[1/2, (-1 + n)/2, (1 + n)/2, Cos[e
 + f*x]^2] + a*(-1 + n)*Cos[e + f*x]*(2*b*(1 + n)*Hypergeometric2F1[1/2, n/2, (2 + n)/2, Cos[e + f*x]^2] + a*n
*Cos[e + f*x]*Hypergeometric2F1[1/2, (1 + n)/2, (3 + n)/2, Cos[e + f*x]^2]))*Sqrt[Sin[e + f*x]^2])/(f*(-1 + n)
*n*(1 + n)))

________________________________________________________________________________________

Maple [F]
time = 0.11, size = 0, normalized size = 0.00 \[\int \left (d \cos \left (f x +e \right )\right )^{n} \left (a +b \sec \left (f x +e \right )\right )^{2}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*cos(f*x+e))^n*(a+b*sec(f*x+e))^2,x)

[Out]

int((d*cos(f*x+e))^n*(a+b*sec(f*x+e))^2,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cos(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((b*sec(f*x + e) + a)^2*(d*cos(f*x + e))^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cos(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((b^2*sec(f*x + e)^2 + 2*a*b*sec(f*x + e) + a^2)*(d*cos(f*x + e))^n, x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (d \cos {\left (e + f x \right )}\right )^{n} \left (a + b \sec {\left (e + f x \right )}\right )^{2}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cos(f*x+e))**n*(a+b*sec(f*x+e))**2,x)

[Out]

Integral((d*cos(e + f*x))**n*(a + b*sec(e + f*x))**2, x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cos(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((b*sec(f*x + e) + a)^2*(d*cos(f*x + e))^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (d\,\cos \left (e+f\,x\right )\right )}^n\,{\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*cos(e + f*x))^n*(a + b/cos(e + f*x))^2,x)

[Out]

int((d*cos(e + f*x))^n*(a + b/cos(e + f*x))^2, x)

________________________________________________________________________________________